package com.lou1052.core.serializer;

import com.lou1052.core.util.serialization.JavaSerializerUtil;

import java.io.InputStream;
import java.io.OutputStream;

/**
 * Created with IntelliJ IDEA.
 * User: liuqing
 * Date: 2015/10/18
 * Time: 14:42
 * To change this template use File | Settings | File Templates.
 */
public class JavaSerializer implements Serializer {

    public static final String NAME="jdk";

    @Override
    public String name() {
        return NAME;
    }

    @Override
    public byte[] serData(Object object) {
        return JavaSerializerUtil.serializer(object);
    }

    @Override
    public <T> T deserData(byte[] data, Class<T> clazz) {
        return JavaSerializerUtil.deserializer(data);
    }

    @Override
    public <T> T readData(InputStream stream, Class<T> clazz) {
        return null;
    }

    @Override
    public void writeData(OutputStream stream, Object toWrite) {

    }

    @Override
    public byte[] serObject(Object object) {
        return JavaSerializerUtil.serializer(object);
    }

    @Override
    public Object deserObject(byte[] data) {
        return JavaSerializerUtil.deserializer(data);
    }

    @Override
    public Object readObject(InputStream stream) {
        return null;
    }

    @Override
    public void writeObject(OutputStream stream, Object toWrite) {

    }
}
